package flc.ast.utils;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import flc.ast.bean.WorkTimeBean;


@Dao//对表操作，增删改查
public interface WorkTimeDao {
    @Insert
    void insertWorkTime(WorkTimeBean... workTimeBeans);

    @Update
    void updateWorkTime(WorkTimeBean... workTimeBeans);

    //条件删除
    @Delete
    void deleteWorkTime(WorkTimeBean... workTimeBeans);

    //删除所有
    @Query("DELETE FROM WorkTimeBean")
    void deleteAllWorkTime();

    @Query("SELECT * FROM WorkTimeBean ORDER BY ID DESC")
    List<WorkTimeBean> getAllWorkTime();

    @Query("SELECT * FROM WorkTimeBean WHERE DATE = :date")
    List<WorkTimeBean> getTodayWorkTime(long date);

    @Query("SELECT * FROM WorkTimeBean WHERE DATE >= :startDate AND date <= :endDate")
    List<WorkTimeBean> getWeekWorkTime(long startDate, long endDate);

    @Query("SELECT * FROM WorkTimeBean WHERE DATE >= :startDate AND date < :endDate")
    List<WorkTimeBean> getMonthWorkTime(long startDate, long endDate);

}

